package com.bst.bsj.common.dal.ibatis;


import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.bst.bsj.common.dal.daointerface.MemberDAO;
import com.bst.bsj.common.dal.dataobject.Member;
import com.sylinxsoft.tools.dao.impl.CommonBaseDAOImpl;

@Service("memberDAO")
@SuppressWarnings("unchecked")
public class MemberDAOImpl extends CommonBaseDAOImpl implements MemberDAO {

  @Override
  public Long getCounts(Map paramMap) {
    return (Long) getSqlMapClientTemplate().queryForObject(getNameSpace() + ".MS_QUERY_COUNT", paramMap);
  }

  @Override
  public List<Member> selectAll(Map paramMap, Long offset, Long length) {
    paramMap.put("offset", offset);
    paramMap.put("length", length);
    return (List<Member>) this.getSqlMapClientTemplate().queryForList(getNameSpace() + ".MS_QUERY_PAGE", paramMap);
  }

  @Override
  public Member getMember(Long id) {
    return (Member) getSqlMapClientTemplate().queryForObject(getNameSpace() + ".MS_SELECT", id);
  }

  @Override
  public int update(Member member) {
    return getSqlMapClientTemplate().update(getNameSpace() + ".MS_UPDATE", member);
  }

  @Override
  public List<Map<String, Object>>  queryAll(Map<String, Object> paramsMap) {
    return  (List<Map<String, Object>> ) getSqlMapClientTemplate().queryForList(getNameSpace() + ".MS_QUERY_ALL_COUNT", paramsMap);
  }

  @Override
  public List<String> getAllUid(Map<String, Object> paramsMap) {
    return (List<String> ) getSqlMapClientTemplate().queryForList(getNameSpace() + ".MS_GET_ALL_UID", paramsMap);
  }

  @Override
  public void deleteByParams(Map<String, Object> paramsMap) {
    getSqlMapClientTemplate().delete(getNameSpace() + ".MS_DELETE", paramsMap);    
  }

}
